﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Showroom.DAL;

namespace Showroom.BLL
{
    public class View_ListCategory : _View_ListCategory
    {
        public static View_ListCategory GetListCategory(int? parentID)
        {
            try
            {
                View_ListCategory cats = new View_ListCategory();
                if (parentID != null)
                {
                    cats.Where.ParentID.Value = parentID;
                    cats.Query.Load();
                }
                else
                {
                    cats.LoadAll();
                    cats.Filter = View_ListCategory.ColumnNames.ParentID + " is NULL";
                }
                return cats;
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
    }
}
